<?php
$id      = $_POST['id'];
$name    = $_POST['name'];
$content = $_POST['content'];
$state   = $_POST['state'];
@mysql_connect('localhost', 'root', 'root');
$errno = mysql_errno();
if (mysql_errno()) {
    die("$errno" . mysql_error());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "update `lanmu` set `name`='$name',`content`='$content',`state`='$state' where id=$id";
$res = mysql_query($sql);
if ($res) {
    echo "<script>alert('修改成功');window.location.href='index.php'</script>";
} else {
    echo "<script>alert('修改失败');window.location.href='update.php'</script>";
}

mysql_close();
